package basic.socket.tcp;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author bingo
 * @Description
 * @Date 2018/7/18
 */
public class ServerDemo1 {

    public static void main(String[] args) {
        ServerSocket serverSocket = null;
            try {
                serverSocket = new ServerSocket(8888);
                Socket socket = serverSocket.accept();
                InputStream inputStream = socket.getInputStream();
                byte[] bys = new byte[1024];
                inputStream.read(bys);
                System.out.println(bys.length);
                String str = new String(bys);
                System.out.println(str);
            } catch (Exception e) {
                e.printStackTrace();
            }

    }
}
